/******************************************************************************
**                                                                           **
** Copyright (C)    (2016)                                              **
**                                                                           **
** All rights reserved.                                                      **
**                                                                           **
** This document contains proprietary information belonging to .        **
** Passing on and copying of this document, and communication                **
** of its contents is not permitted without prior written authorization.     **
**                                                                           **
*******************************************************************************
**                                                                           **
**  $FILENAME   : ComStack_Types.h $                                         **
**                                                                           **
**  AUTHOR      :                                                            **
**                                                                           **
**  VENDOR      :                                                            **
**                                                                           **
**  DESCRIPTION :This file is partly ECU dependent.                          **
**               Implemented SWS: Communication Stack Types (ComStackTypes)  **
**                                                                           **
**  SPECIFICATION(S) :   AUTOSAR classic Platform 4.2.2                      **
**                                                                           **
******************************************************************************/
#ifndef COMSTACK_TYPES_H
#define COMSTACK_TYPES_H

#include "Std_Types.h"
#include "ComStack_Cfg.h"

/* Variables of this type shall be used to store the basic information
 * about a PDU of any type, namely a pointer variable pointing to its SDU (payload),
 * and the corresponding length of the SDU in bytes.*/
typedef struct
{
	P2VAR(uint8, TYPEDEF, TYPEDEF) SduDataPtr;
	PduLengthType SduLength;
} PduInfoType;

/*Used to store the identifier of a partial network cluster.*/
typedef uint8 PNCHandleType;

/*Specify the parameter to which the value has to be changed (BS or STmin).*/
typedef enum
{
	TP_STMIN = 0, /*Separation Time*/
	TP_BS = 1,    /*Block Size*/
	TP_BC = 2     /*The Band width control parameter used in FlexRay transport
	               protocol module.*/
} TPParameterType;

/*Variables of this type shall be used to store the result of a buffer request.*/
typedef enum
{
    BUFREQ_OK = 0,       /*Buffer request accomplished successful.*/
	BUFREQ_E_NOT_OK = 1, /*Buffer request not successful. Buffer cannot be accessed*/
	BUFREQ_E_BUSY = 2,   /*Temporarily no buffer available. It's up the requester
	                      to retry request for a certain time.*/
	BUFREQ_E_OVFL = 3    /*No Buffer of the required length can be provided*/
} BufReq_ReturnType;

/*Variables of this type shall be used to return the bus status evaluated by
 * a transceiver.*/
typedef uint8 BusTrcvErrorType;

#define BUSTRCV_OK      0x00u
#define BUSTRCV_E_ERROR 0x01u

/*Variables of this type shall be used to store the state of TP buffer.*/
typedef enum
{
    TP_DATACONF = 0,   /*Indicates that all data, that have been copied so far,
                        are confirmed and can be removed from the TP buffer.*/
	TP_DATARETRY = 1,  /*indicates that this API call shall copy already copied
	                    data in order to recover from an error.*/
	TP_CONFPENDING = 2 /*indicates that the previously copied data must remain
	                    in the TP.*/
} TpDataStateType;

/*Variables of this type shall be used to store the information about Tp
 * buffer handling.*/
typedef struct
{
	TpDataStateType TpDataState; /*The enumeration type to be used to store the
	                              state of Tp buffer.*/
	PduLengthType TxTpDataCnt;   /*Offset from the current position which identifies
	                              the number of bytes to be retransmitted.*/
} RetryInfoType;

/*Variables of the type NetworkHandleType shall be used to store the identifier
 * of a communication channel.*/
typedef uint8 NetworkHandleType;

/*IcomConfigIdType defines the configuration ID. An ID of 0 is the default
 * configuration. An ID greater than 0 shall identify a configuration for
 * Pretended Networking. There is more than 1 configuration possible.*/
typedef uint8 IcomConfigIdType;

typedef enum
{
	ICOM_SWITCH_E_OK,
	ICOM_SWITCH_E_FAILED
} IcomSwitch_ErrorType;

#endif /* COMSTACK_TYPES_H */
